11  Interactive Map Visualisation

# install.packages("devtools")
#devtools::install_github("thiyangt/ceylon")
library(ceylon)

11.1 Static Plot

ggplot(province) + 
  geom_sf(mapping = aes(fill = population), show.legend = TRUE) + scale_fill_viridis()

11.2 Using mapview

mapview(
  province,
  zcol = "population",
  legend = TRUE
)

11.3 Using leaflet

m <- leaflet() %>%
  addTiles() %>%  # OpenStreetMap tiles
  addMarkers(
    lng = 79.8612,
    lat = 6.9271,
    popup = "Colombo, Sri Lanka"
  )
m
#htmltools::save_html(m, file = "../HtmlWidget/leaflet-sri-lanka.html")